cmake_minimum_required(VERSION 2.8)
project(domset)
add_definitions("-std=c++11")

SET(CMAKE_MODULE_PATH
  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
OPTION (DOMSET_USE_OPENMP "Use OpenMP" OFF)
IF(DOMSET_USE_OPENMP)
  FIND_PACKAGE(OpenMP)
  IF(OPENMP_FOUND)
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    add_definitions(-DDOMSET_USE_OPENMP)

    IF(WIN32)
      IF(MSVC)
        add_definitions(-DDOMSET_VISUAL_STUDIO)
        message("Using for loops with signed integer counters")
      else()
        message("Using for loops with unsigned integer counters")
      endif()
    else()
      message("Using for loops with unsigned integer counters")
    endif()
  else()
    message (FATAL_ERROR "Cant find openmp library")
  ENDIF()
ENDIF()

if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
  find_package(Eigen)
  if(EIGEN_FOUND) 
    include_directories(${EIGEN_INCLUDE_DIR})
  else()
    message(FATAL_ERROR "Can't find Eigen packages")
  endif()
else()
  include_directories(${EIGEN_INCLUDE_DIR}) 
endif()

set(domset_HEADERS ${domset_SOURCE_DIR}/types.h ${domset_SOURCE_DIR}/domset.h)
add_library(domset domset.cc ${domset_HEADERS})
